﻿@model List<DLULearningNetworkModel.OtherNotification>
@using DLULearningNetwork.Libs;
@using DLULearningNetworkModel;
@{
    Account currentUser = DLULearningNetwork.ActionFilterAttributes.RequireUserLogin.LoginUser;
}
@if (Model != null && Model.Count != 0)
{
    <ul>
        @foreach (DLULearningNetworkModel.OtherNotification on in Model)
        {
        
            <li NotificationID="@on.OtherNotificationID_u" typeNotification="other">
                <div class="record" style="clear: both; border-bottom: 1px solid green; padding: 5px 0 5px 5px;">
                    @{ EnumFeedType feedType = (EnumFeedType)Enum.Parse(typeof(EnumFeedType), on.FeedReference.Value.Type_s);
                    }
                    @switch (feedType)
                    {
                        case EnumFeedType.ActivityPostOnWallFriend:
                         <div style="float: left; padding-right: 3px; width: 40px;">
                            <a href="/UserPage/UserHome/@on.FeedReference.Value.AccountReference.Value.Nickname_s" onclick="HasReadNotification('@on.OtherNotificationID_u','other')">
                                <img src="@DLULearningNetwork.Libs.StringHelper.GetImageUrl(on.FeedReference.Value.AccountReference.Value.Avatar_s, 1)" style="width: 40px; height: 40px; float: left; padding-right: 3px;" />
                            </a>
                        </div>
                       <div style=" vertical-align: top; position: relative; display: block;">
                            <a href="#" name="checkNotification" style ="display:none;margin:0;padding:0;float:right;" >
                                <img src="../../Content/Images/check.png" title="Xóa" />

                            </a><span style="display: block;">
                               <a href="/UserPage/UserHome/@on.FeedReference.Value.AccountReference.Value.Nickname_s">@on.FeedReference.Value.AccountReference.Value.FirstName_s</a> </span> vừa đăng<a href="/Feed/Detail/@StringHelper.GetGuidFromContent(on.FeedReference.Value.Content_s)" style="color:Green;">
                                    bài viết</a> lên tường nhà bạn <span>"@MvcHtmlString.Create(StringHelper.GetContentFromContent(on.FeedReference.Value.Content_s).Replace("\\n", "<br>"))"</span>
                        </div>
                        <div style="clear: both;">
                        </div>
                                                                     break;
                        case EnumFeedType.ActivityComment:
                        <div style="float: left; padding-right: 3px; width: 40px;">
                            <a href="/UserPage/UserHome/@on.FeedReference.Value.AccountReference.Value" onclick="HasReadNotification('@on.OtherNotificationID_u','other')">
                                <img src="@DLULearningNetwork.Libs.StringHelper.GetImageUrl(on.FeedReference.Value.AccountReference.Value.Avatar_s, 1)" style="width: 40px; height: 40px; float: left; padding-right: 3px;" />
                            </a>
                        </div>
                        <div style=" vertical-align: top; position: relative; display: block;">
                            <a href="#" name="checkNotification" style ="display:none;margin:0;padding:0;float:right;">
                                <img src="../../Content/Images/check.png" title="Xóa" />
                            </a><span style="display: block;">
                                <a href="/UserPage/UserHome/@on.FeedReference.Value.AccountReference.Value.Nickname_s">@on.FeedReference.Value.AccountReference.Value.FirstName_s</a></span> bình luận 
                            <a href="/Feed/Detail/@on.FeedReference.Value.FeedCommentReference.Value.FeedReference.Value.FeedID_u" style="color:Green;">
                                bài viết</a>
                            @if (on.FeedReference.Value.FeedCommentReference.Value.FeedReference.Value.AccountReference.Value.AccountID_u == currentUser.AccountID_u)
                            {
                                <span>của bạn trên tường nhà </span>
                                if (on.FeedReference.Value.FeedCommentReference.Value.FeedReference.Value.PassiveAccountID_u == currentUser.AccountID_u)
                                { 
                                <span>bạn </span>
                                }
                                else
                                { 
                                <a href="/UserPage/UserHome/@on.FeedReference.Value.FeedCommentReference.Value.FeedReference.Value.Account1Reference.Value.Nickname_s" style="color:Green;">
                                @on.FeedReference.Value.FeedCommentReference.Value.FeedReference.Value.Account1Reference.Value.FirstName_s</a>
                                }
                            }
                            else
                            {
                                <span>của <a href="/UserPage/UserHome/@on.FeedReference.Value.FeedCommentReference.Value.FeedReference.Value.AccountReference.Value.Nickname_s">@on.FeedReference.Value.FeedCommentReference.Value.FeedReference.Value.AccountReference.Value.FirstName_s</a>
                                    trên tường nhà </span>
                                if (on.FeedReference.Value.FeedCommentReference.Value.FeedReference.Value.PassiveAccountID_u == currentUser.AccountID_u)
                                { 
                                <span>bạn </span>
                                }
                                else
                                { 
                                <a  href="/UserPage/UserHome/@on.FeedReference.Value.FeedCommentReference.Value.FeedReference.Value.Account1Reference.Value.Nickname_s">@on.FeedReference.Value.FeedCommentReference.Value.FeedReference.Value.Account1Reference.Value.FirstName_s</a>
                                }
                            }
                            <span>"@MvcHtmlString.Create(StringHelper.GetContentFromContent(on.FeedReference.Value.Content_s).Replace("\\n", "<br>"))"</span>
                        </div>
                        <div style="clear: both;">
                        </div>
                              break;
                    }
                </div>
            </li>
        }
    </ul>
}
else
{ 
    <p name="noMore">
        Chưa có thông báo mới</p>
}